package com.liuzh.deviceinfo.card;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.e;
import androidx.recyclerview.widget.RecyclerView.z;
import c.h.a.m0.k;
import c.h.a.z.g;
import c.h.a.z.r;
import java.util.ArrayList;
import java.util.Objects;

public class CpuStatusCard extends RecyclerView {
    public c F0;
    public Runnable G0 = new a();

    public class a implements Runnable {
        public void run() {
            ArrayList P = k.P();
            c cVar = CpuStatusCard.this.F0;
            Objects.requireNonNull(cVar);
            c.h.a.m0.p.a.b(new g(cVar, P));
        }
    }

    public static class b extends b.p.b.n.b {
        public final ArrayList<c.h.a.d0.c> a;
        public final ArrayList<c.h.a.d0.c> b;

        public b(ArrayList<c.h.a.d0.c> arrayList, ArrayList<c.h.a.d0.c> arrayList2) {
            this.a = arrayList;
            this.b = arrayList2;
        }

        public boolean a(int i, int i2) {
            return ((c.h.a.d0.c) this.a.get(i)).b.equals(((c.h.a.d0.c) this.b.get(i2)).b);
        }

        public boolean b(int i, int i2) {
            return ((c.h.a.d0.c) this.a.get(i)).a.equals(((c.h.a.d0.c) this.b.get(i2)).a);
        }
    }

    public static class c extends e<a> {
        public Context c;
        public ArrayList<c.h.a.d0.c> d;

        public static class a extends z {
            public TextView t;
            public TextView u;

            public a(View view) {
                super(view);
                this.t = (TextView) view.findViewById(2131296753);
                this.u = (TextView) view.findViewById(2131297325);
            }
        }

        public c(Context context, ArrayList<c.h.a.d0.c> arrayList) {
            this.c = context;
            this.d = arrayList;
        }

        public int a() {
            return this.d.size();
        }

        public void f(z zVar, int i) {
            a aVar = (a) zVar;
            String str = ((c.h.a.d0.c) this.d.get(i)).a;
            String str2 = ((c.h.a.d0.c) this.d.get(i)).b;
            aVar.t.setText(str);
            aVar.u.setText(str2);
        }

        public z g(ViewGroup viewGroup, int i) {
            return new a(LayoutInflater.from(this.c).inflate(2131492985, viewGroup, false));
        }
    }

    public CpuStatusCard(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        setVerticalScrollBarEnabled(false);
        int i = 2;
        if (Runtime.getRuntime().availableProcessors() != 2) {
            i = 4;
        }
        setLayoutManager(new r(this, getContext(), i));
        c cVar = new c(getContext(), new ArrayList());
        this.F0 = cVar;
        setAdapter(cVar);
        setItemAnimator(null);
    }
}
